﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ShiziEntity.User
{
    /// <summary>
    /// 经纪人权限控制实体
    /// </summary>
    [Serializable]
    public class UserAgentCon
    {
        public UserAgentCon()
        {
        }

        private int userID;
        private string userName;
        private string cityName;
        private int? houseLimit;
        private int? houseCurrent;
        private int? houseMax;
        private int? houseCount;
        private int? goodHouseCount;
        private int? csCurrent;
        private int? csCount;
        private int? csGoodCount;
        private int? csAdd;
        private int? csMod;
        private int? csRef;
        private int? csDel;
        private int? czCurrent;
        private int? czCount;
        private int? czGoodCount;
        private int? czAdd;
        private int? czMod;
        private int? czRef;
        private int? czDel;
        private DateTime? lastLoginTime;
        private int? score;

        /// <summary>
        /// 用户编号
        /// </summary>
        public int UserID
        {
            set { userID = value; }
            get { return userID; }
        }
        /// <summary>
        /// 用户名
        /// </summary>
        public string UserName
        {
            set { userName = value; }
            get { return userName; }
        }
        /// <summary>
        /// 城市
        /// </summary>
        public string CityName
        {
            set { cityName = value; }
            get { return cityName; }
        }
        /// <summary>
        /// 每日最大发布量
        /// </summary>
        public int? HouseLimit
        {
            set { houseLimit = value; }
            get { return houseLimit; }
        }
        /// <summary>
        /// 房源发布量
        /// </summary>
        public int? HouseCurrent
        {
            set { houseCurrent = value; }
            get { return houseCurrent; }
        }
        /// <summary>
        /// 最大库存量
        /// </summary>
        public int? HouseMax
        {
            set { houseMax = value; }
            get { return houseMax; }
        }
        /// <summary>
        /// 房源库存量
        /// </summary>
        public int? HouseCount
        {
            set { houseCount = value; }
            get { return houseCount; }
        }
        /// <summary>
        /// 优质房源量
        /// </summary>
        public int? GoodHouseCount
        {
            set { goodHouseCount = value; }
            get { return goodHouseCount; }
        }
        /// <summary>
        /// 出售发布
        /// </summary>
        public int? CsCurrent
        {
            set { csCurrent = value; }
            get { return csCurrent; }
        }
        /// <summary>
        /// 出售库存
        /// </summary>
        public int? CsCount
        {
            set { csCount = value; }
            get { return csCount; }
        }
        /// <summary>
        /// 出售优质
        /// </summary>
        public int? CsGoodCount
        {
            set { csGoodCount = value; }
            get { return csGoodCount; }
        }
        /// <summary>
        /// 出售录入
        /// </summary>
        public int? CsAdd
        {
            set { csAdd = value; }
            get { return csAdd; }
        }
        /// <summary>
        /// 出售修改
        /// </summary>
        public int? CsMod
        {
            set { csMod = value; }
            get { return csMod; }
        }
        /// <summary>
        /// 出售刷新
        /// </summary>
        public int? CsRef
        {
            set { csRef = value; }
            get { return csRef; }
        }
        /// <summary>
        /// 出售删除
        /// </summary>
        public int? CsDel
        {
            set { csDel = value; }
            get { return csDel; }
        }
        /// <summary>
        /// 出租发布
        /// </summary>
        public int? CzCurrent
        {
            set { czCurrent = value; }
            get { return czCurrent; }
        }
        /// <summary>
        /// 出租库存
        /// </summary>
        public int? CzCount
        {
            set { czCount = value; }
            get { return czCount; }
        }
        /// <summary>
        /// 出租优质
        /// </summary>
        public int? CzGoodCount
        {
            set { czGoodCount = value; }
            get { return czGoodCount; }
        }
        /// <summary>
        /// 出租录入
        /// </summary>
        public int? CzAdd
        {
            set { czAdd = value; }
            get { return czAdd; }
        }
        /// <summary>
        /// 出租修改
        /// </summary>
        public int? CzMod
        {
            set { czMod = value; }
            get { return czMod; }
        }
        /// <summary>
        /// 出租刷新量
        /// </summary>
        public int? CzRef
        {
            set { czRef = value; }
            get { return czRef; }
        }
        /// <summary>
        /// 出租删除
        /// </summary>
        public int? CzDel
        {
            set { czDel = value; }
            get { return czDel; }
        }
        /// <summary>
        /// 最后登录时间
        /// </summary>
        public DateTime? LastLoginTime
        {
            set { lastLoginTime = value; }
            get { return lastLoginTime; }
        }
        /// <summary>
        /// 积分
        /// </summary>
        public int? Score
        {
            set { score = value; }
            get { return score; }
        }

        /// <summary>
        /// 获取保存用户权限信息的SQL
        /// </summary>
        /// <returns>SQL语句</returns>
        public virtual string GetInsertSql()
        {
            StringBuilder sql = new StringBuilder();
            StringBuilder sqlField = new StringBuilder();
            StringBuilder sqlValue = new StringBuilder();
            if (this.UserID > -1)
            {
                sqlField.Append("UserID,");
                sqlValue.Append("" + this.UserID + ",");
            }
            if (this.UserName != null)
            {
                sqlField.Append("UserName,");
                sqlValue.Append("'" + this.UserName + "',");
            }
            if (this.CityName != null)
            {
                sqlField.Append("CityName,");
                sqlValue.Append("'" + this.CityName + "',");
            }
            if (this.HouseLimit != null)
            {
                sqlField.Append("HouseLimit,");
                sqlValue.Append("" + this.HouseLimit + ",");
            }
            if (this.HouseCurrent != null)
            {
                sqlField.Append("HouseCurrent,");
                sqlValue.Append("" + this.HouseCurrent + ",");
            }
            if (this.HouseMax != null)
            {
                sqlField.Append("HouseMax,");
                sqlValue.Append("" + this.HouseMax + ",");
            }
            if (this.HouseCount != null)
            {
                sqlField.Append("HouseCount,");
                sqlValue.Append("" + this.HouseCount + ",");
            }
            if (this.GoodHouseCount != null)
            {
                sqlField.Append("GoodHouseCount,");
                sqlValue.Append("" + this.GoodHouseCount + ",");
            }
            if (this.CsCurrent != null)
            {
                sqlField.Append("CsCurrent,");
                sqlValue.Append("" + this.CsCurrent + ",");
            }
            if (this.CsCount != null)
            {
                sqlField.Append("CsCount,");
                sqlValue.Append("" + this.CsCount + ",");
            }
            if (this.CsGoodCount != null)
            {
                sqlField.Append("CsGoodCount,");
                sqlValue.Append("" + this.CsGoodCount + ",");
            }
            if (this.CsAdd != null)
            {
                sqlField.Append("CsAdd,");
                sqlValue.Append("" + this.CsAdd + ",");
            }
            if (this.CsMod != null)
            {
                sqlField.Append("CsMod,");
                sqlValue.Append("" + this.CsMod + ",");
            }
            if (this.CsRef != null)
            {
                sqlField.Append("CsRef,");
                sqlValue.Append("" + this.CsRef + ",");
            }
            if (this.CsDel != null)
            {
                sqlField.Append("CsDel,");
                sqlValue.Append("" + this.CsDel + ",");
            }
            if (this.CzCurrent != null)
            {
                sqlField.Append("CzCurrent,");
                sqlValue.Append("" + this.CzCurrent + ",");
            }
            if (this.CzCount != null)
            {
                sqlField.Append("CzCount,");
                sqlValue.Append("" + this.CzCount + ",");
            }
            if (this.CzGoodCount != null)
            {
                sqlField.Append("CzGoodCount,");
                sqlValue.Append("" + this.CzGoodCount + ",");
            }
            if (this.CzAdd != null)
            {
                sqlField.Append("CzAdd,");
                sqlValue.Append("" + this.CzAdd + ",");
            }
            if (this.CzMod != null)
            {
                sqlField.Append("CzMod,");
                sqlValue.Append("" + this.CzMod + ",");
            }
            if (this.CzRef != null)
            {
                sqlField.Append("CzRef,");
                sqlValue.Append("" + this.CzRef + ",");
            }
            if (this.CzDel != null)
            {
                sqlField.Append("CzDel,");
                sqlValue.Append("" + this.CzDel + ",");
            }
            if (this.LastLoginTime != null)
            {
                sqlField.Append("LastLoginTime,");
                sqlValue.Append("'" + this.LastLoginTime + "',");
            }
            if (this.Score != null)
            {
                sqlField.Append("Score,");
                sqlValue.Append("" + this.Score + ",");
            }
            sql.Append("insert into UserAgentCon(");
            sql.Append(sqlField.ToString().Remove(sqlField.Length - 1));
            sql.Append(")");
            sql.Append(" values (");
            sql.Append(sqlValue.ToString().Remove(sqlValue.Length - 1));
            sql.Append(")");
            return sql.ToString();
        }
    }
}